export default {
  methods: {
    controllGetLocation(xbase) {
      return this.getXData(this.getXMeta('xfield', {xbase}))
    },
    controllToLocation(xbase) {
      this.invokeXOneMethod('onXUtilLocation', {
        // defaultValue: {
        //   lng: this.getXData('_'+this.getXMeta('xfield')+'_lng', {xbase}),
        //   lat: this.getXData('_'+this.getXMeta('xfield')+'_lat', {xbase}),
        // },
        callback: e=>{
          this.setXData(this.getXMeta('xfield', {xbase}), e.address)
          this.setXData(this.getXMeta('xfield1', {xbase}), `${e.latitude},${e.longitude}`)
        }
      })
    },
    controllGetSelectValue(value, options=[], multiple) {
      if(value===undefined||value===null) return undefined
      if(multiple)
        return options.filter(v=>value.includes(v.value)).map(v=>v.label).join(',')
      else
        return options.filter(v=>value === v.value).map(v=>v.label)[0]
    },
  }
}